package com.example.collegevice.mapper;

import com.example.pojo.Notice;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface NoticeMapper {
    @Insert("insert into notice (id, title, content, time)" +
            "values (#{id}, #{title}, #{content}, #{time})")
    void insert(Notice notice);

    @Select("select * from notice")
    List<Notice> selectAll();

    @Select("select * from notice where title like concat('%', #{title}, '%')")
    List<Notice> selectByTitle(String title);

    @Update("update notice set title= #{title}, content= #{content}, time= #{time} "+"where id = #{id}")
    void updateById(Notice notice);

    @Delete("delete from notice where id = #{id}")
    void deleteById(Integer id);
}
